const express = require("express");
const router = express.Router();
const conf = require("../mod/config");
const request = require("../mod/request");
/*
天籁之音blockNum=1
*/
router.get('/', function(req, res, next) {
  request.all(
    [{
      path: "/GetHotSinger?pageIndex=1&pageSize=8",
      clientReq: req
    }, {
      path: "/GetHotMusic?pageindex=1&pagesize=5",
      clientReq: req
    },
    { path: "/GetBigBannerList?blockNum=2", clientReq: req }
    ],
    (data) => {
      res.render("audio_visual", {
        conf: conf,
        name: "audio",
        singers: data[0] || [],
        music: data[1] || [],
        banners:data[2].hasValue == "true" && data[2].data || [],
      });
    },
    (error) => {
      res.render("404", {
        conf: conf
      });
    }
  );
});
//更多热门歌手
router.get('/hotsinger', function(req, res, next) {
  request.all(
    [{
      path: "/GetHotSinger?pageIndex=1&pageSize=20",
      clientReq: req
    }],
    (data) => {
      res.render("hot_singer", {
        conf: conf,
        singers: data[0] || []
      });
    },
    (error) => {
      res.render("404", {
        conf: conf
      });
    }
  );
});
//查询所有
router.get('/search', function(req, res, next) {
  res.render("search_all", {
    conf: conf
  });
});
module.exports = router;